/* Dump or view gcc passes.


   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */ 

#include "gml4gtk-plugin.h"

static void
dump_passes_to_file (char *fname)
{
  return;
}

/* Public function to dump the gcc pass lists.  */

void
dot_plugin_dump_pass_lists (void)
{
  dot_plugin_common.init ();

  dump_passes_to_file ("dump-pass-lists.dot");

  dot_plugin_common.finish ();

  return;
}

/* Public function to view the gcc pass lists.  */

void
dot_plugin_view_pass_lists (void)
{
  dot_plugin_common.init ();

  dump_passes_to_file (dot_plugin_common.temp_file_name);
  dot_plugin_common.show (dot_plugin_common.temp_file_name);

  dot_plugin_common.finish ();

  return;
}

/* Plugin callback function for PLUGIN_FINISH event.
   Dump gcc pass lists.  */

void *
dot_plugin_callback_pass_lists (void *gcc_data, void *user_data)
{
  dot_plugin_dump_pass_lists ();
  return NULL;
}

/* Plugin callback function for PLUGIN_START_UNIT event.
   Dump the pass list.  */

void *
dot_plugin_callback_passes_start (void *gcc_data, void *user_data)
{
printf("%s()\n",__FUNCTION__);

  /* Do some initialization.  */

  dot_plugin_common.init ();
  return NULL;
}

/* Plugin callback function for PLUGIN_OVERRIDE_GATE event.  Create a node for
   the current pass, and set node color as green if the gate status value is
   true, grey for false.  */

void *
dot_plugin_callback_pass (void *gcc_data, void *user_data)
{
printf("%s()\n",__FUNCTION__);
  return NULL;
}

/* Plugin callback function for PLUGIN_FINISH_UNIT event.
   Dump the pass list.  */

void *
dot_plugin_callback_passes_finish (void *gcc_data, void *user_data)
{
  char *fname;
printf("%s()\n",__FUNCTION__);
  fname = concat (dump_base_name, ".passes.dot", NULL);
  dot_plugin_common.dump (fname);
  free (fname);

  dot_plugin_common.finish ();
  return NULL;
}

/* end */
